/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package thienphuc.patient.dao.impl;

import java.util.List;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Restrictions;
import thienphuc.patient.dao.AbstractHibernateDaoSupport;
import thienphuc.patient.dao.NhomThuocDAO;
import thienphuc.patient.dto.NhomThuoc;

/**
 *
 * @author QuocDat
 */
public class NhomThuocDAOImpl extends AbstractHibernateDaoSupport<NhomThuoc, Integer> implements NhomThuocDAO {

    public NhomThuocDAOImpl(Class<NhomThuoc> classPersistent) {
        super(classPersistent);
    }

    public List<NhomThuoc> findByTenNhom(String tenNhom) throws Exception {
        Criterion criterionTenNhom = Restrictions.like(NHOM_THUOC_TEN_NHOM, "%" + tenNhom + "%");
        return this.findByCriteria(criterionTenNhom);
    }

    public List<NhomThuoc> findByTrangThai(boolean trangThai) throws Exception {
        return this.findByProperty(NHOM_THUOC_TRANG_THAI, trangThai);
    }
}
